<?php

namespace App\Console;

use App\Models\Prize;
use App\Models\PrizeUser;
use App\Models\RcUser;
use Illuminate\Console\Scheduling\Schedule;
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;

class Kernel extends ConsoleKernel
{
    /**
     * The Artisan commands provided by your application.
     *
     * @var array
     */
    protected $commands = [
        //
    ];

    /**
     * Define the application's command schedule.
     *
     * @param  \Illuminate\Console\Scheduling\Schedule  $schedule
     * @return void
     */
    protected function schedule(Schedule $schedule)
    {
        // $schedule->command('inspire')->hourly();
        $schedule->call(function () {
//            $data =[
//                ['id'=>1,'num'=>250],
//                ['id'=>2,'num'=>400],
//                ['id'=>3,'num'=>150],
//                ['id'=>4,'num'=>2000],
//                ['id'=>5,'num'=>1400],
//                ['id'=>6,'num'=>15],
//                ['id'=>7,'num'=>15],
//                ['id'=>8,'num'=>15],
//                ['id'=>9,'num'=>15],
//                ['id'=>10,'num'=>6000],
//                ['id'=>11,'num'=>6000],
//                ['id'=>12,'num'=>6000],
//                ['id'=>13,'num'=>2],
//                ['id'=>14,'num'=>2]
//                ];
//            foreach ($data as $k){
//                Prize::query()->where('id',$k['id'])->increment('sum',$k['num']);
//            }
            RcUser::query()->update(['luck_sum'=>1]);
        })->everyMinute();
    }

    /**
     * Register the commands for the application.
     *
     * @return void
     */
    protected function commands()
    {
        $this->load(__DIR__.'/Commands');

        require base_path('routes/console.php');
    }
}
